#ifndef _FILE_OPERA_H
#define _FILE_OPERA_H

#include "main.h"
#include "ff.h"
#include "lcd.h"
#include <stdio.h>
#include <stdlib.h>
#include "rtc.h"
#include "fatfs.h"
#include "norflash.h"
#include "key_led.h"
#include "usart.h"
#include "semphr.h"
#include "fifo.h"

typedef enum{
  file_txt  	 = 0,
  file_wav  	 = 1,
  file_txt_end 	 = 10,
  file_wav_end 	 = 11,
  file_wav_full  = 21,
  file_wav_break = 31,
  file_stop 	 = 99,
}filetypes;

void fatTest_GetDiskInfo();
void fatTest_ScanDir(const TCHAR* PathName);
void fatTest_WriteTXTFile(TCHAR* filename, uint16_t year, uint8_t month, uint8_t day);
FRESULT fatTest_WriteBinFile(TCHAR* filename, uint8_t* data, uint32_t size);
FRESULT fatTest_ReadTXTFile(TCHAR* filename, uint8_t* str, uint16_t size);
FRESULT fatTest_ReadBinFile(TCHAR* filename, uint8_t* data, uint32_t size, uint32_t pos);
void fatTest_GetFileInfo(TCHAR* filename, uint32_t* filesize);

void fatTest_WriteWavFile(TCHAR* filename, uint8_t* data, uint32_t len);
void fatTest_ReadWavFile(TCHAR* filename, uint8_t* data, uint32_t* filesize);

filetypes get_MessType(uint8_t* str, uint8_t* filename, uint8_t* filesize);

DWORD fat_GetFatTimeFromRTC();

#endif
